<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ include file="static/imgHost.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>商家页面</title>
    
	<script src="js/fontSize.js"></script>
	<script src="js/jquery-1.11.3.min.js"></script>
	
	<script src="plugins/layer/layer.js"></script>
    <link rel="stylesheet" href="plugins/layer/skin/default/layer.css"/>
    
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=F6eTaN7pws2E23tdZL5BHPQeRWBXyLbW"></script>
    
    <link rel="stylesheet" href="css/style.css"/>
    <link rel="stylesheet" href="css/style2.css"/>
    <script src="js/swiper.min.js"></script>
    <style>
		body{ background:#F5F5F6;}
	</style>
	<script>
		var root = "shop";
	</script>
</head>

<body>
	<!--头部1-->
	<c:import url="/static/top.jsp"></c:import>
	<!--/头部1-->
  
	<!--筛选-->
	<div class="shade"></div>
	<div class="shaixuan">
		<ul class="shaixuan-dsx">
			<li class="fenlei-on1">
				<c:choose>
					<c:when test="${empty name or tn == ''}"><samp index="0">全部分类</samp></c:when>
					<c:otherwise><samp index="0">${name}</samp></c:otherwise>
				</c:choose>
				<span class="zcsq iclsr1"></span>
			</li>
			<li class="fenlei-on2"><samp index="0">全城</samp><span class="zcsq iclsr1"></span></li>
			<li class="fenlei-on3"><samp index="1">默认排序</samp><span class="zcsq iclsr1"></span></li>
		</ul>
		<div class="clear-both"></div>
		<!--下拉-->
		<div class="shaixuan-xial">
			<!--全部分类-->
		    <div class="shaixuan-wwfz">
				<div class="shaixuan-sxla">
					<ul>
						<c:forEach items="${industrys}" var="industry">
							<li><b lang="${industry.id}">${industry.name}</b><span>${industry.shop_count}</span></li>
						</c:forEach>
					</ul>
				</div>
				<div class="shaixuan-rzfl">
				<c:forEach items="${industrys}" var="industry">
					<ul>
						<c:forEach items="${industrySmalls}" var="industrySmall">
							<c:if test="${industry.id == industrySmall.parent_id}">
								<li><a href="javascript:void(0)"><b lang="${industry.id},${industrySmall.id}">${industrySmall.name}</b><span>${industrySmall.shop_count}</span></a></li>
							</c:if>
						</c:forEach>
					</ul>
				</c:forEach>
				</div>
			</div>
		    <!--全部分类-->
		
		    <!--全城-->
			<div class="shaixuan-wwfz">
				<div class="shaixuan-sxla">
					<ul>
						<c:forEach items="${areas}" var="area">
							<li><b lang="${area.code}">${area.name}</b><span>${area.shop_count}</span></li>
						</c:forEach>
					</ul>
				</div>
	
				<div class="shaixuan-rzfl">
				<c:forEach items="${areas}" var="area">
					<ul>
						<c:forEach items="${streets}" var="street">
							<c:if test="${area.code == street.area}">
								<li><a href="javascript:void(0)"><b lang="${area.code},${street.id}">${street.street}</b><span>${street.shop_count}</span></a></li>
							</c:if>
						</c:forEach>
					</ul>
				</c:forEach>
				</div>
			</div>
			<!--全城-->
		        
		    <!--智能排序-->
			<div class="shaixuan-wwfz znpx">
				<div class="shaixuan-sxla">
					<ul>
						<li><a href="javascript:void(0)"><b lang="1">默认排序</b></a></li>
						<li><a href="javascript:void(0)"><b lang="2">离我最近</b></a></li>
						<li><a href="javascript:void(0)"><b lang="3">评价最高</b></a></li>
						<li><a href="javascript:void(0)"><b lang="4">最新发布</b></a></li>
					</ul>
				</div>
			</div>
			<!--智能排序-->
		</div>
		<!--/下拉-->
	</div>
	<!--/筛选-->

	<!--当前位置-->
	<section class="dqwz padding-lr1 background11 bottom1 border-color2">
		<span class="dqwz-tiela color3">当前：${street_info}</span>
		<span class="cursor-pointer ico bgico-11" style="background-image: url(images/img37.png);"></span>
	</section>
	<!--/当前位置-->
  
	<!--信息列表-->
	<section class="xinslie background4">
		<ul class="yohpls sklidr  border-color1">
		<c:forEach items="${shops}" var="shop">
		<a href="<%=basePath%>shop/${shop.id}#1">
			<li class="padding-lr1 background4 overflow-hidden border-top1 border-bottom1 border-color1" style="height: auto;">
				<div class="grzxsj-left skmeuab float-left overflow-hidden">
					<div class="skmeuab-right">
						<img class="border-radius5" src="<%=imgHost%>${shop.pic}">
					</div>
					<div class="skmeuab-left">
						<h3 style="width:100%;height:15px;"><span style="float:left">${shop.name}</span><samp class="xbggk" style="float:left">
								<span class="color1 border-radius2" style="background:#ff0000">包</span>
								<!-- <span class="color1 background9 border-radius2">刮</span> -->
							</samp></h3>
						<p class="float-right" style="text-align:right;">
							<samp class="yf-zi"><img src="<%=basePath%>images/5555.png" style="width:14%;height:14%;margin-right:0px;margin-top:0.2rem;"> ${shop.limit_amount}元</samp>
						</p>
						<div class="zdklert pfen3 grzxsj-left float-left overflow-hidden">
							<div class="xjipf" style="height: 1.55rem;">
								<div class="xjipf-mrpf pfen3-fz" style="height: 1.55rem; width: 80%;"></div>
							</div>
							<div class="djkkwr hlcsoer color3">${shop.commentNum}评价</div>
							<samp class="pfjwe pfen3-fs color8 display-none">
								<span>${shop.totalStar}</span>分
							</samp>
						</div>
						<p class="skmeuab-left-zub color3">
							<span>${shop.industryName} ${shop.areaName}</span>
	
							<span class="float-right">${shop.distance}</span>
						</p>
					</div>
				</div>
			</li>
		</a>
		</c:forEach>
		</ul>
	</section>
	<!--/信息列表-->
  

	<!--底部1-->
  <div class="footer-1-height"></div>  
  <c:import url="/static/scan.jsp"></c:import>
  <!--/底部1-->

  <script src="js/style.js"></script>
  <script type="text/javascript">
  	function search() {
  		var search_industry = $(".fenlei-on1 samp").attr("index");
  		var search_city = $(".fenlei-on2 samp").attr("index");
  		var sort = $(".fenlei-on3 samp").attr("index");
  		
  		var city = $("#city_txt").text();
  		var area = "";
  		var street = "";
  		if (search_city != "0") {
  			var ss = search_city.split(",");
  			area = ss[0];
  			if (ss.length > 1) {
  				street = ss[1];
  			}
  		}
  		var industry = "0";
  		var industry_small = "0";
  		if (search_industry != "0") {
  			var ss = search_industry.split(",");
  			industry = ss[0];
  			if (ss.length > 1) {
  				industry_small = ss[1];
  			}
  		}
  		var ctx = "${pageContext.request.contextPath}";
  		var imgHost = "<%=imgHost%>";
  		$.ajax({
  		    type : "post",
  		    url : ctx+'/shop/search',
  		    dataType:"json",
  		  	data: {
  		  		city : city,
  		  		area : area,
  		  		street : street,
  		  		industry : industry,
  		  		industry_small : industry_small
	        },
  		    success : function(msg) {
  		    	var shops = msg.shops;
  		    	var html = "";
  		    	for (var i =0; i<shops.length; i++) {
  		    		html += '<a href="'+ctx+'/shop/'+shops[i].id+'#1">';
  		    		html += '<li class="padding-lr1 background4 overflow-hidden border-top1 border-color1" style="height: auto;">';
  		    		html += '<div class="grzxsj-left skmeuab float-left overflow-hidden">';
  		    		html += '<div class="skmeuab-right">';
  		    		html += '<img class="border-radius5" src="'+imgHost+shops[i].pic+'">';
  		    		html += '</div>';
  		    		html += '<div class="skmeuab-left">';
  		    		html += '<h3>'+shops[i].name+'</h3>';
  		    		html += '<div class="zdklert pfen3 grzxsj-left float-left overflow-hidden">';
  		    		html += '<div class="xjipf" style="height: 1.55rem;">';
  		    		html += '<div class="xjipf-mrpf pfen3-fz" style="height: 1.55rem; width: 80%;"></div>';
  		    		html += '</div>';
  		    		html += '<div class="djkkwr hlcsoer color3">'+shops[i].commentNum+'评价</div>';
  		    		html += '<samp class="pfjwe pfen3-fs color8 display-none">';
  		    		html += '<span>0</span>分';
  		    		html += '</samp>';
  		    		html += '</div>';
  		    		html += '<p class="skmeuab-left-zub color3">';
  		    		html += '<span>'+shops[i].industryName+' '+shops[i].areaName+'</span>';
  		    		html += '<samp class="xbggk">';
  		    		html += '<span class="color1 background6 border-radius2">寻</span>';
  		    		html += '</samp>';
  		    		html += '<span class="float-right">'+shops[i].distance+'</span>';
  		    		html += '</p></div></div></li></a>';
  		    	}
  		    	$(".yohpls").html(html);
  		    }
  		});
  		
  	}
  </script>
</body>
</html>